
import VueRouter from "vue-router";

const routes = [
    {
        path:'/',
        name:'login',
        component:()=>import('../components/MyLogin')
    },
    {
        path:'/MyIndex',
        name:'index',
        component:()=>import('../components/MyIndex'),
        children:[
            {
                path:'/MyHome',
                name:'home',
                meta:{
                    title:'首页'
                },
                component:()=>import('../components/MyHome')
            },
            /*{
                path:'/MyAdmin',
                name:'admin',
                meta:{
                    title:'管理员管理'
                },
                component:()=>import('../components/admin/MyAdminManage.vue')
            },
            {
                path:'/MyUser',
                name:'user',
                meta:{
                    title:'用户管理'
                },
                component:()=>import('../components/user/MyUserManage.vue')
            },*/
        ]
    }
]

const router = new VueRouter({
    mode:'history',
    routes
})

export function resetRouter(){
    router.matcher = new VueRouter({
        mode:'history',
        routes:[]
    }).matcher
}

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to){
    return VueRouterPush.call(this,to).catch(err => err)
}

export default router;